package czk.concrent.lockSupport;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * @Author:ChenZhangKun
 * @Date: 2022/9/19 15:28
 */
public class LockSupportDemo2 {
    public static void main(String[] args) {
        Long start = System.nanoTime();
        System.out.println("开始时间 " + start);
        // 	阻塞当前线程，最长不超过nanos纳秒，增加了超时返回的特性
        LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(3L));
        Long end = +System.nanoTime();
        System.out.println("结束时间 " + end);
        System.out.println("时间差 =" + (end - start) / (TimeUnit.SECONDS.toNanos(1)));
    }
}
